package com.bw.liveplay.common.mvvm.mondel

import com.bw.liveplay.common.entity.BaseEntity
import com.bw.liveplay.common.entity.DissEntity
import com.bw.liveplay.common.entity.HomeFeedEntity
import com.bw.liveplay.common.entity.LoveEntity
import com.bw.liveplay.common.network.Api
import com.bw.liveplay.common.utils.ApiService
import io.reactivex.Observable

/**
 * @author KK
 * @description:
 * @date :2021/11/10 13:07
 *
 */
open class HomeListModel : BaseModel() {

    //段子列表
    fun requestHomeList(feedId:Int,feedType:String,pageCount:Int,userId:Int) : Observable<BaseEntity> {
        val homeOB :Observable<HomeFeedEntity> = ApiService.instance().getRetrofit()!!
            .create(Api::class.java)
            .requestHomeList(feedId, feedType, pageCount, userId)

        return changeFun(homeOB)
    }

    //喜欢
    fun requestLove(itemId:Long,userId:Int) : Observable<BaseEntity>{
        val loveOb :Observable<LoveEntity> = ApiService.instance().getRetrofit()!!
            .create(Api::class.java)
            .requestLove(itemId,userId)

        return changeFun(loveOb)
    }

    //踩
    fun requestDiss(itemId:Long,userId:Int) : Observable<BaseEntity>{
        val loveOb :Observable<DissEntity> = ApiService.instance().getRetrofit()!!
            .create(Api::class.java)
            .requestDiss(itemId,userId)

        return changeFun(loveOb)
    }


}